<%@ page contentType="text/html;charset=UTF-8" %> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>


<h3>Przedmioty</h3>

<form:form commandName="subject">
<table>

	<tr>
	<td colspan="2">
	
	<div style="color: green">${dodano}</div>

	
	</td>
	</tr>
	<tr>
	<td colspan="2">
	
	<form:errors path="subjectName" cssClass="error_box" />

	
	</td>
	</tr>
	<tr>
		<td><form:label path="subjectName">Nazwa przedmiotu:</form:label></td>
		<td><form:input path="subjectName" /></td>
	</tr>
</table>
	<input type="submit" value="Dodaj" />
</form:form>
<br /><br />
<c:if test="${subjectsList.size() != 0}">
<table class="content_table">
	<tr>
		<th>Nazwa przedmiotu</th>
		<th>Opcje</th>
	</tr>
<c:forEach items="${subjectsList}" var="subject">

<tr>
		<td>
		${subject.subjectName}
		
		</td>
		<td>
		<a href="<c:url value="/admin/subject/edit" />?id=${subject.subjectId}" >
		<img src="<c:url value="/resources/edit.gif" />" /> 
		</a>
		
		<a href="<c:url value="/admin/subject/delete" />?id=${subject.subjectId}" >
		<img src="<c:url value="/resources/delete.gif" />" />
		</a>
		
		</td>
	</tr>

</c:forEach>
</table>
<br />

<!--  PAGE MENU -->
<c:if test="${subjects.getPage() != 0}">
<a href="<c:url value="/admin/subjects" />?page=${subjects.getPage()-1}" />
</c:if>
<
<c:if test="${subjects.getPage() != 0}">
</a>
</c:if>
<c:forEach begin="0" end="${subjects.getPageCount()-1}" var="page">
<c:if test="${subjects.getPage() != page}">
<a href="<c:url value="/admin/subjects" />?page=${page}" />
</c:if>
${page+1}
<c:if test="${subjects.getPage() != page}">
</a>
</c:if> 
</c:forEach>
<c:if test="${subjects.getPage() != subjects.getPageCount()-1}">
<a href="<c:url value="/admin/subjects" />?page=${subjects.getPage()+1}" />
</c:if>
>
<c:if test="${subjects.getPage() != 0}">
</a>
</c:if>
<!--  PAGE MENU KONIEC -->
</c:if>